package io.tij;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

public class Endians {
	public static void main(String[] args){
		ByteBuffer bb = ByteBuffer.allocate(12);
		bb.asCharBuffer().put("abcdef");
		
		bb.rewind();
		System.out.println();
		while(bb.hasRemaining())
			System.out.print(bb.get() + " ");
		
		bb.rewind();
		System.out.println();
		bb.order(ByteOrder.BIG_ENDIAN);
		bb.asCharBuffer().put("abcdef");
		while(bb.hasRemaining())
			System.out.print(bb.get() + " ");

		bb.rewind();
		System.out.println();
		bb.order(ByteOrder.LITTLE_ENDIAN);
		bb.asCharBuffer().put("abcdef");
		while(bb.hasRemaining())
			System.out.print(bb.get() + " ");
		
	}
}
